.class public Lrexsee/storage/RexseePreference;
.super Ljava/lang/Object;
.source "RexseePreference.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field private static final INTERFACE_NAME:Ljava/lang/String; = "Preference"


# instance fields
.field private final DEFAULT_PREFERENCE_NAME:Ljava/lang/String;

.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mContext:Landroid/content/Context;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 1
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 30
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 25
    const-string v0, "defaultRexseePreference"

    iput-object v0, p0, Lrexsee/storage/RexseePreference;->DEFAULT_PREFERENCE_NAME:Ljava/lang/String;

    .line 31
    iput-object p1, p0, Lrexsee/storage/RexseePreference;->mBrowser:Lrexsee/core/browser/Browser;

    .line 32
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/storage/RexseePreference;->mContext:Landroid/content/Context;

    .line 33
    return-void
.end method


# virtual methods
.method public clear()V
    .locals 1

    .prologue
    .line 91
    const-string v0, "defaultRexseePreference"

    invoke-virtual {p0, v0}, Lrexsee/storage/RexseePreference;->clear(Ljava/lang/String;)V

    .line 92
    return-void
.end method

.method public clear(Ljava/lang/String;)V
    .locals 4
    .param p1, "preferenceName"    # Ljava/lang/String;

    .prologue
    .line 94
    iget-object v2, p0, Lrexsee/storage/RexseePreference;->mContext:Landroid/content/Context;

    const/4 v3, 0x0

    invoke-virtual {v2, p1, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v1

    .line 95
    .local v1, "preference":Landroid/content/SharedPreferences;
    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 96
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->clear()Landroid/content/SharedPreferences$Editor;

    .line 97
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 98
    return-void
.end method

.method public exists(Ljava/lang/String;)Z
    .locals 1
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 37
    const-string v0, "defaultRexseePreference"

    invoke-virtual {p0, p1, v0}, Lrexsee/storage/RexseePreference;->exists(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public exists(Ljava/lang/String;Ljava/lang/String;)Z
    .locals 3
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "preferenceName"    # Ljava/lang/String;

    .prologue
    const/4 v2, 0x0

    .line 40
    iget-object v1, p0, Lrexsee/storage/RexseePreference;->mContext:Landroid/content/Context;

    invoke-virtual {v1, p2, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    .line 41
    .local v0, "preference":Landroid/content/SharedPreferences;
    if-nez v0, :cond_0

    move v1, v2

    :goto_0
    return v1

    :cond_0
    invoke-interface {v0, p1}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z

    move-result v1

    goto :goto_0
.end method

.method public get(Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 56
    const-string v0, "defaultRexseePreference"

    invoke-virtual {p0, p1, v0}, Lrexsee/storage/RexseePreference;->get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .locals 4
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "preferenceName"    # Ljava/lang/String;

    .prologue
    const-string v3, ""

    .line 62
    iget-object v1, p0, Lrexsee/storage/RexseePreference;->mContext:Landroid/content/Context;

    const/4 v2, 0x0

    invoke-virtual {v1, p2, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    .line 63
    .local v0, "preference":Landroid/content/SharedPreferences;
    if-nez v0, :cond_0

    const-string v1, ""

    move-object v1, v3

    :goto_0
    return-object v1

    :cond_0
    const-string v1, ""

    invoke-interface {v0, p1, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    goto :goto_0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 18
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 14
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/storage/RexseePreference;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "Preference"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getItem(Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 59
    invoke-virtual {p0, p1}, Lrexsee/storage/RexseePreference;->get(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getKeys()Ljava/lang/String;
    .locals 1

    .prologue
    .line 66
    const-string v0, "defaultRexseePreference"

    invoke-virtual {p0, v0}, Lrexsee/storage/RexseePreference;->getKeys(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getKeys(Ljava/lang/String;)Ljava/lang/String;
    .locals 8
    .param p1, "preferenceName"    # Ljava/lang/String;

    .prologue
    const-string v7, "\""

    .line 69
    iget-object v4, p0, Lrexsee/storage/RexseePreference;->mContext:Landroid/content/Context;

    const/4 v5, 0x0

    invoke-virtual {v4, p1, v5}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v2

    .line 70
    .local v2, "preference":Landroid/content/SharedPreferences;
    if-nez v2, :cond_0

    const-string v4, ""

    .line 76
    :goto_0
    return-object v4

    .line 71
    :cond_0
    invoke-interface {v2}, Landroid/content/SharedPreferences;->getAll()Ljava/util/Map;

    move-result-object v4

    invoke-interface {v4}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v4

    invoke-interface {v4}, Ljava/util/Set;->toArray()[Ljava/lang/Object;

    move-result-object v0

    .line 72
    .local v0, "arr":[Ljava/lang/Object;
    const-string v3, ""

    .line 73
    .local v3, "rtn":Ljava/lang/String;
    const/4 v1, 0x0

    .local v1, "i":I
    :goto_1
    array-length v4, v0

    if-lt v1, v4, :cond_1

    .line 76
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "["

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "]"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    goto :goto_0

    .line 74
    :cond_1
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    if-nez v1, :cond_2

    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "\""

    invoke-direct {v5, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    aget-object v6, v0, v1

    invoke-virtual {v6}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, "\""

    invoke-virtual {v5, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    :goto_2
    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 73
    add-int/lit8 v1, v1, 0x1

    goto :goto_1

    .line 74
    :cond_2
    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, ",\""

    invoke-direct {v5, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    aget-object v6, v0, v1

    invoke-virtual {v6}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, "\""

    invoke-virtual {v5, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    goto :goto_2
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 22
    new-instance v0, Lrexsee/storage/RexseePreference;

    invoke-direct {v0, p1}, Lrexsee/storage/RexseePreference;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method

.method public remove(Ljava/lang/String;)V
    .locals 1
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 79
    const-string v0, "defaultRexseePreference"

    invoke-virtual {p0, p1, v0}, Lrexsee/storage/RexseePreference;->remove(Ljava/lang/String;Ljava/lang/String;)V

    .line 80
    return-void
.end method

.method public remove(Ljava/lang/String;Ljava/lang/String;)V
    .locals 4
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "preferenceName"    # Ljava/lang/String;

    .prologue
    .line 85
    iget-object v2, p0, Lrexsee/storage/RexseePreference;->mContext:Landroid/content/Context;

    const/4 v3, 0x0

    invoke-virtual {v2, p2, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v1

    .line 86
    .local v1, "preference":Landroid/content/SharedPreferences;
    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 87
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 88
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 89
    return-void
.end method

.method public removeItem(Ljava/lang/String;)V
    .locals 0
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 82
    invoke-virtual {p0, p1}, Lrexsee/storage/RexseePreference;->remove(Ljava/lang/String;)V

    .line 83
    return-void
.end method

.method public set(Ljava/lang/String;Ljava/lang/String;)V
    .locals 1
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # Ljava/lang/String;

    .prologue
    .line 44
    const-string v0, "defaultRexseePreference"

    invoke-virtual {p0, p1, p2, v0}, Lrexsee/storage/RexseePreference;->set(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 45
    return-void
.end method

.method public set(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 4
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # Ljava/lang/String;
    .param p3, "preferenceName"    # Ljava/lang/String;

    .prologue
    .line 50
    iget-object v2, p0, Lrexsee/storage/RexseePreference;->mContext:Landroid/content/Context;

    const/4 v3, 0x0

    invoke-virtual {v2, p3, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v1

    .line 51
    .local v1, "preference":Landroid/content/SharedPreferences;
    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 52
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 53
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 54
    return-void
.end method

.method public setItem(Ljava/lang/String;Ljava/lang/String;)V
    .locals 0
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # Ljava/lang/String;

    .prologue
    .line 47
    invoke-virtual {p0, p1, p2}, Lrexsee/storage/RexseePreference;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 48
    return-void
.end method
